<template>
	<div class="goods-comment">
		<div class="head">
			<div class="data" v-if="evaluatelist && evaluatelist.salesCount">
				<p>
					<span>{{ evaluatelist.salesCount }}</span
					><span>人购买</span>
				</p>
				<p>
					<span>{{ evaluatelist.praisePercent }}</span
					><span>好评率</span>
				</p>
			</div>
			<div class="tags" v-if="evaluatelist">
				<div class="dt">大家都在说：</div>
				<div class="dd">
					<span class="active">全部评价({{ evaluatelist.evaluateCount }})</span>
					<span>有图({{ evaluatelist.hasPictureCount }})</span>
					<span v-for="(item, index) in evaluatelist.tags" :key="index">{{ item.title }}({{ item.tagCount }})</span>
				</div>
			</div>
		</div>
		<div class="sort">
			<span>排序：</span>
			<span class="active">默认</span>
			<span>最新</span>
			<span>最热</span>
		</div>
		<div class="list" v-if="evaluatelist2 && evaluatelist2.items">
			<div class="item" v-for="(item, index) in evaluatelist2.items" :key="index">
				<div class="user">
					<img :src="item.member.avatar" alt="" />
					<span>{{ item.member.nickname }}</span>
				</div>
				<div class="body">
					<div class="score" v-if="item.score && item.orderInfo.specs">
						<span v-if="item.score && item.orderInfo.specs"><i class="iconfont icon-wjx01" v-for="i in item.score" :key="i"></i></span>
						<span v-if="item.score && item.orderInfo.specs"><i class="iconfont icon-wjx02" v-for="i in 5 - item.score" :key="i"></i></span>
						<span class="attr" v-for="(it, key) in item.orderInfo.specs" :key="key">{{ it.name }}:{{ it.nameValue }}</span>
					</div>
					<div class="text">
						{{ item.content }}
					</div>
					<div class="time">
						<span>{{ item.orderInfo.createTime }}</span>
						<span class="zan"><i class="iconfont icon-dianzan"></i>{{item.praiseCount}}</span>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>
<script>
export default {
	name: "GoodsComment",
	props: ["evaluatelist", "evaluatelist2"],
};
</script>
<style scoped lang="scss">
.list {
	padding: 0 20px;
	.item {
		display: flex;
		padding: 25px 10px;
		border-bottom: 1px solid #f5f5f5;
		.user {
			width: 160px;
			img {
				width: 40px;
				height: 40px;
				border-radius: 50%;
				overflow: hidden;
			}
			span {
				padding-left: 10px;
				color: #666;
			}
		}
		.body {
			flex: 1;
			.score {
				line-height: 40px;
				.iconfont {
					color: #ff9240;
					padding-right: 3px;
				}
				.attr {
					padding-left: 10px;
					color: #666;
				}
			}
		}
		.text {
			color: #666;
			line-height: 24px;
		}
		.time {
			color: #999;
			display: flex;
			justify-content: space-between;
			margin-top: 5px;
		}
	}
}
.goods-comment {
	.head {
		height: 184px;
		display: flex;
		padding-top: 20px;
		// padding: 30px 0;
		.data {
			width: 340px;
			display: flex;
			// padding: 20px;
			p {
				flex: 1;
				text-align: center;
				padding-top: 30px;
				// line-height: 00px;
				span {
					display: block;
					// line-height: 10px;
					&:first-child {
						font-size: 32px;
						color: red;
					}
					&:last-child {
						color: #999;
					}
				}
			}
		}
		.tags {
			flex: 1;
			display: flex;
			border-left: 1px solid #f5f5f5;
			.dt {
				font-weight: bold;
				width: 100px;
				text-align: right;
				line-height: 42px;
			}
			.dd {
				flex: 1;
				display: flex;
				flex-wrap: wrap;
				> span {
					width: 132px;
					height: 42px;
					margin-left: 20px;
					margin-bottom: 20px;
					border-radius: 4px;
					border: 1px solid #e4e4e4;
					background: #f5f5f5;
					color: #999;
					text-align: center;
					line-height: 40px;
					&:hover {
						border-color: #27ba9b;
						background: lighten(#27ba9b, 50%);
						color: #27ba9b;
					}
					&.active {
						border-color: #27ba9b;
						background: #27ba9b;
						color: #fff;
					}
				}
			}
		}
	}
	.sort {
		height: 60px;
		line-height: 60px;
		border-top: 1px solid #f5f5f5;
		border-bottom: 1px solid #f5f5f5;
		margin: 0 20px;
		color: #666;
		> span {
			margin-left: 20px;
		}
		> span {
			margin-left: 30px;
			&.active,
			&:hover {
				color: #27ba9b;
			}
		}
	}
}
</style>
